import request from '@/util/request'
import md5 from 'js-md5'

export function forgetPassword(userName) {
  return request({
    url: `/login/forgetPassword/${userName}.json`,
    method: 'get',
    baseURL: process.env.VUE_APP_AJS_USER
  })
}

export function check(headers, code) {
  return request({
    url: `/login/forgetPassword/check/${code}.json`,
    method: 'post',
    headers,
    baseURL: process.env.VUE_APP_AJS_USER
  })
}

export function resetPassword(headers, uuid) {
  headers.userPassword = md5(headers.userPassword)
  return request({
    url: `/login/resetPassword/${uuid}.json`,
    method: 'patch',
    headers,
    baseURL: process.env.VUE_APP_AJS_USER
  })
}
